<!--
 * @Author: kangjia
 * @Date: 2022-09-29 10:09:44
 * @LastEditors: error: git config user.name && git config user.email & please set dead value or install git
 * @LastEditTime: 2022-10-12 16:21:44
 * @FilePath: \boss-web-applet\pages\service\introduce\module\xmcCssAction.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
	<view v-if="(message.message.expirationtimeColor&&message.message.expirationtimeColor==='primary') || (message.channelMessage&&message.channelMessage.normalUseChannel) " class="flex margin-bottom-sm">
		<view v-for="(item,i) in list" :key="i" class="flex-sub  radius">
			<view class="flex flex-direction">
				<view :class="item.class">
					<button class="cu-btn bg-whites" style="font-size:24upx;width:96%;position: relative;height:80upx" @tap="handleClick(item)">
						<image class="text-left" :src="`https://statics.xmcsrv.net/weixin/cloud/action/${item.icon}.svg`" mode="aspectFit" style="width:60upx;height:52upx;position: absolute;left:10upx"></image>
					<text class="margin-left-lg">{{item.name}}</text>
					</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	props:{
		list:{
			type:Array,
			default:()=>{
				return []
			}
		},
		message:{
			type:Object,
			default:()=>{
				return{}
			}
		}
	},
	data(){
		return{
			selectDeviceInfo:{}
		}
	},
	watch:{
		message(val){
			this.selectDeviceInfo=val
		}
	},
	methods:{
		handleClick (item){
			const { type } = item;
			const {message,channelMessage} = state.selectDeviceInfo;
			let devId = message.devId || channelMessage.sn;//单通道和多通道获取设备序列号
			switch(type){
				case 'yun':
					if(channelMessage&&channelMessage.normalUseChannel){
						this.$emit('channelClick')
					}else{
						// proxy.openCloudPlayBack({devId,chnId:-1})
					}
			    break;
			    case 'alarmSetting':
			    // proxy.openAlarmSettings({devId});
			    break;
		    }
		}
	}
}
</script>
<style lang="less" scoped>
	@import '@/common/style/main.css';
</style>
